import 'package:flutter/material.dart';
import 'package:get/get.dart';

import 'logic.dart';

class EssayPage extends StatelessWidget {
  EssayPage({Key? key}) : super(key: key);

  final EssayLogic logic = Get.put(EssayLogic());

  @override
  Widget build(BuildContext context) {
    return Scaffold(
      appBar: AppBar(
        title: Text("短文列表"),
      ),
      body: Obx(() {
        return ListView.builder(
          itemCount: logic.goods.length,
          itemBuilder: (context, index) {
            final value = logic.goods[index];
            return Container(
              padding: const EdgeInsets.all(8),
              decoration: BoxDecoration(
                border: Border.all(
                  color: const Color.fromRGBO(233, 233, 233, 0.9),
                  width: 1
                )
              ),
              child: Column(
                children: <Widget>[
                  const SizedBox(height: 12),
                  Text(
                    value.essaytitle ?? '',
                    textAlign: TextAlign.center,
                    style: const TextStyle(fontSize: 20),
                  )
                ],
              ),
            );
          },
        );
      }),
    );
  }
}

